package com.yugao.fintech.draper.auth.api;

import com.yugao.fintech.draper.common.constant.ServerConstant;
import com.yugao.fintech.draper.datasource.entity.PageResult;
import com.yugao.fintech.draper.core.model.ResultVO;
import com.yugao.fintech.draper.feign.annotation.FeignBackoff;
import com.yugao.fintech.draper.feign.annotation.FeignRetry;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Map;

@FeignClient(contextId = "tokenFeignApi", value = ServerConstant.DRAPER_AUTH)
public interface TokenFeignApi {
	/**
	 * 分页查询token
	 */
	@FeignRetry(maxAttempt = 5, backoff = @FeignBackoff(delay = 500L))
	@PostMapping("/token/page")
	ResultVO<PageResult> pageQuery(@RequestBody Map<String, Object> params);

	/**
	 * 删除token
	 */
	@DeleteMapping("/token/{token}")
    ResultVO<Void> removeToken(@PathVariable("token") String token);

}
